/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package casino;

/**
 *
 * @author amaghfur
 */
public class Bet {
    
    /** the amount bet */
    private Rational amountBet;
    /** the associated outcome */
    private Outcome outcome;
    
    /**
     * Constructor specifying the amount bet to the selected outcome.
     * 
     * @param startAmountBet    starting amountBet
     * @param startOutcome      assigned outcome
     */
    public Bet(Rational startAmountBet, Outcome startOutcome) {
        amountBet = startAmountBet;
        outcome = startOutcome;
    }
    
    /** getter for amountBet */
    public Rational getAmountBet() {
        return amountBet;
    }
    
    /** getter for outcome */
    public Outcome getOutcome() {
        return outcome;
    }
    
    /**
     * Returns the amount won on this bet plus the initial bet.
     * 
     * @return  sum of winnings and initial bet
     */
    public Rational winAmount() {
    	Rational winAmount;
        winAmount = outcome.getOdds().times(amountBet);
        return winAmount.plus(amountBet);
    }
    
    /**
     * Returns the amount to be lost on this bet. This equals the original bet.
     * 
     * @return  amount to be lost
     */
    public Rational loseAmount() {
        return amountBet;
    }
    
    /**
     * Returns a string representation of this bet with the form "amount on outcome".
     * 
     * @return  string representation of this bet
     */
    @Override
    public String toString() {
        return amountBet.toString() + " on " + outcome.toString();
    }
    
}
